#include<bits/stdc++.h>
using namespace std;
long long n, l, r;
int main(){
	freopen("candy.in", "r", stdin);
	freopen("candy.out", "w", stdout);
	cin >> n >> l >> r;
	int nn = n;
	n = n * (l / nn + 1);
	if(l <= n - 1 && n - 1 <= r) cout << nn - 1 << endl;
	else cout << r % nn << endl;
	return 0;
}
